package com.example.demo;

import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;

/**
 * @Description:
 * @Author: LiangJiawen
 * @Create Date Time: 2021/4/19 14:17.
 * @Update Date Time: 
 * @see
 */
public class MyTest extends ParentTest implements IMyTest, InitializingBean {

    private String name;
    private int age;

    public MyTest(){
        System.out.println("======【MyTest无参构造方法】======");
    }

    public MyTest(String name){
        System.out.println("======【MyTest有参构造方法】======");
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public void say() {
        System.out.println("hi!" + this.name + " " + this.age);
    }

    public void init(){
        System.out.println("======【MyTest---init方法】======");
        this.name = "王五";
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("======【MyTest---afterPropertiesSet方法】======");
        this.age = 18;
    }

    @PostConstruct
    public void test(){
        System.out.println("======【MyTest---@PostConstruct注解】======");
    }
}
